
package edu.tongji.jiaowu.dao.jdbc;
 
import java.util.List;

import edu.tongji.jiaowu.dao.EvQuestionVDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class EvQuestionVDaoJdbc extends BaseDaoJdbc implements EvQuestionVDao {
	String tableName="V_EV_QUESTION";
	String beanName="evQuestionV";
	
	public CommonBean createEvQuestionV(){
		CommonBean evQuestionVs=this.createBean(tableName,beanName);
                return evQuestionVs;		
	}
	
/*
	public CommonBean findEvQuestionVs(String refid) {
		CommonBean evQuestionVs=this.createEvQuestionV();
		String sql="select * from V_EV_QUESTION where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		evQuestionVs.addData(data);
                return evQuestionVs;
       }
*/
	public CommonBean findEvQuestionVById(String id) {
		CommonBean evQuestionVs=this.createEvQuestionV();
		String sql="select * from V_EV_QUESTION where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		evQuestionVs.addData(data);
    return evQuestionVs;
  }
  
	public CommonBean findAllEvQuestionVs() {
		CommonBean evQuestionVs=this.createEvQuestionV();
		String sql="select * from V_EV_QUESTION ";
		List data=this.getCommonDao().select(sql,new String[]{});
		evQuestionVs.addData(data);
    return evQuestionVs;
  }
	public void insertEvQuestionV(CommonBean evQuestionVBean){
		List data=evQuestionVBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}
	public void updateEvQuestionV(CommonBean evQuestionVBean){
		List data=evQuestionVBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchUpdate(row,data);
	}

	public CommonBean findVEvQuestionByClass(String year, String semester, String classCode, String courseType) {
		String sql="select * from v_ev_question where school_year=? and school_semester=? and class_code=? and course_type=? order by item_code,code";
		List data=getCommonDao().select(sql, new String[]{year,semester,classCode,courseType});
		CommonBean bean=createBean(tableName,beanName);
		bean.addData(data);
		return bean;
	}
}

